﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BlackBird.Models;
using System.Web.UI;

namespace BlackBird.Controllers
{
	public partial class CommonController : Controller
    {
        //
        // GET: /Common/

		/// <summary>
		/// 商品partialview
		/// </summary>
		/// <returns></returns>
		[HttpGet]
		[OutputCache(Location = OutputCacheLocation.None)]
		public virtual ActionResult NewProduct()
        {
			ProductDM dm = new ProductDM();

			return PartialView(MVC.Shared.Views.BiJiaDan.Product, dm);
        }

		/// <summary>
		/// 创建商品
		/// </summary>
		/// <param name="dm"></param>
		/// <returns></returns>
		[HttpPost]
		[OutputCache(Location = OutputCacheLocation.None)]
		public virtual ActionResult NewProduct(ProductDM dm)
		{
			dm.Id = Guid.NewGuid().ToString();
			return Json(dm, JsonRequestBehavior.AllowGet);
		}


		/// <summary>
		/// 新建供货商
		/// </summary>
		/// <returns></returns>
		[HttpGet]
		[OutputCache(Location = OutputCacheLocation.None)]
		public virtual ActionResult NewSupplier()
		{
			SupplierDM dm = new SupplierDM();

			return PartialView(MVC.Shared.Views.BiJiaDan.Supplier, dm);
		}

		/// <summary>
		/// 创建供货商
		/// </summary>
		/// <param name="dm"></param>
		/// <returns></returns>
		[HttpPost]
		[OutputCache(Location = OutputCacheLocation.None)]
		public virtual ActionResult NewSupplier(SupplierDM dm)
		{
			dm.Id = Guid.NewGuid().ToString();
			return Json(dm, JsonRequestBehavior.AllowGet);
		}
    }
}
